package com.wing.api.app;


import com.alibaba.fastjson.JSONObject;
import com.wing.api.query.cabinet.BaseQueryCabinetService;
import com.wing.api.query.cabinet.QueryCabinetServiceType;
import com.wing.api.query.cellInventoryCabinet.BaseQueryCellInventoryCabinetService;
import com.wing.api.query.cellInventoryCabinet.QueryCellInventoryCabinetServiceType;
import com.wing.api.query.cellInventoryProduct.BaseQueryCellInventoryProductService;
import com.wing.api.query.cellInventoryProduct.QueryCellInventoryProductServiceType;
import com.wing.api.query.cellInventorySpace.BaseQueryCellInventorySpaceService;
import com.wing.api.query.cellInventorySpace.QueryCellInventorySpaceServiceType;
import com.wing.api.query.company.BaseQueryCompanyService;
import com.wing.api.query.company.QueryCompanyServiceType;
import com.wing.api.query.department.BaseQueryDepartmentService;
import com.wing.api.query.department.QueryDepartmentServiceType;
import com.wing.api.query.device.BaseQueryDeviceService;
import com.wing.api.query.device.QueryDeviceServiceType;
import com.wing.api.query.orderReceiveLoad.BaseQueryOrderReceiveLoadService;
import com.wing.api.query.orderReceiveLoad.QueryOrderReceiveLoadServiceType;
import com.wing.api.query.processInfo.BaseQueryProcessInfoService;
import com.wing.api.query.processInfo.QueryProcessInfoServiceType;
import com.wing.api.query.productDetail.BaseQueryProductDetailService;
import com.wing.api.query.productDetail.QueryProductDetailServiceType;
import com.wing.api.query.productPack.BaseQueryProductPackService;
import com.wing.api.query.productPack.QueryProductPackServiceType;
import com.wing.api.query.productSeries.BaseQueryProductSeriesService;
import com.wing.api.query.productSeries.QueryProductSeriesServiceType;
import com.wing.api.query.role.BaseQueryRoleService;
import com.wing.api.query.role.QueryRoleServiceType;
import com.wing.api.query.simpleWorkOrder.BaseQuerySimpleWorkOrderService;
import com.wing.api.query.simpleWorkOrder.QuerySimpleWorkOrderServiceType;
import com.wing.api.query.storageInventoryProduct.BaseQueryStorageInventoryProductService;
import com.wing.api.query.storageInventoryProduct.QueryStorageInventoryProductServiceType;
import com.wing.api.query.storageInventorySpace.BaseQueryStorageInventorySpaceService;
import com.wing.api.query.storageInventorySpace.QueryStorageInventorySpaceServiceType;
import com.wing.api.query.storageSingleInventoryCabinet.BaseQueryStorageSingleInventoryCabinetService;
import com.wing.api.query.storageSingleInventoryCabinet.QueryStorageSingleInventoryCabinetServiceType;
import com.wing.api.query.user.BaseQueryUserService;
import com.wing.api.query.user.QueryUserServiceType;
import com.wing.api.query.warehouse.BaseQueryWarehouseService;
import com.wing.api.query.warehouse.QueryWarehouseServiceType;
import com.wing.api.query.warehouseInventoryType.BaseQueryWarehouseInventoryTypeService;
import com.wing.api.query.warehouseInventoryType.QueryWarehouseInventoryTypeServiceType;
import com.wing.cabinet.model.entity.Cabinet;
import com.wing.cabinet.model.entity.StorageInventorySpace;
import com.wing.cabinet.model.response.*;
import com.wing.cabinet.service.*;
import com.wing.common.utils.JsonResult;
import com.wing.common.utils.PageResult;
import com.wing.common.utils.Result;
import com.wing.enterprise.device.entity.Device;
import com.wing.enterprise.feign.EnterpriseClient;
import com.wing.enterprise.product.model.entity.ProcessInfo;
import com.wing.enterprise.product.model.entity.Product;
import com.wing.enterprise.product.model.entity.ProductDetail;
import com.wing.enterprise.product.model.response.ProcessInfoVO;
import com.wing.enterprise.product.model.response.ProductDetailVO;
import com.wing.order.model.request.OrderReceiveLoadForm;
import com.wing.order.model.response.OrderReceiveLoadDetailVO;
import com.wing.order.service.OrderReceiveLoadDetailService;
import com.wing.product.model.response.ProductPackVO;
import com.wing.product.service.ProductPackService;
import com.wing.production.feign.ProductionClient;
import com.wing.production.workOrder.entity.SimpleWorkOrder;
import com.wing.user.feign.UserClient;
import com.wing.user.model.request.CompanyInfo;
import com.wing.user.model.request.Department;
import com.wing.user.model.request.Role;
import com.wing.user.model.request.User;
import com.wing.warehouse.model.entity.WarehouseInventoryType;
import com.wing.warehouse.model.response.WarehouseVO;
import com.wing.warehouse.service.WarehouseInventoryTypeService;
import com.wing.warehouse.service.WarehouseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Api(value = "App-API", tags = "刀柜列表查询API")
@RestController("appQueryApiController")
@RequestMapping("api/app/query")
@Slf4j
public class ApiQueryController {

    @Autowired
    private EnterpricceIdService enterpricceIdService;
    @Autowired
    private EnterpriseClient enterpriseClient;
    @Autowired
    private UserClient userClient;
    @Autowired
    private ProductionClient productionClient;
    @Autowired
    private ProductPackService productPackService;
    @Autowired
    private WarehouseService warehouseService;
    @Autowired
    private WarehouseInventoryTypeService warehouseInventoryTypeService;
    @Autowired
    private CellInventoryProductService cellInventoryProductService;
    @Autowired
    private CellInventorySpaceService cellInventorySpaceService;
    @Autowired
    private CellSingleInventoryProductService cellSingleInventoryProductService;
    @Autowired
    private StorageInventoryProductService storageInventoryProductService;
    @Autowired
    private StorageInventorySpaceService storageInventorySpaceService;
    @Autowired
    private StorageSingleInventoryProductService storageSingleInventoryProductService;
    @Autowired
    private OrderReceiveLoadDetailService orderReceiveLoadDetailService;

    /**
     *  查询用户列表
     * @return
     */
    @ApiOperation(value = "查询所有用户", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", example = "1", required = true,  dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "limit", value = "每页多少条", example = "10", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "departmentId", value = "部门ID", example = "departmentId", dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "postId", value = "职位ID", example = "postId", dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "username", value = "用户名", example = "username", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nickname", value = "昵称", example = "nickname", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "phone", value = "手机号", example = "13888888888", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryUserList")
    public PageResult<User> queryUserList(Integer page, Integer limit,
                                          Long departmentId, Long postId, String username, String nickname, String phone, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("departmentId", departmentId);
        jsonObject.put("postId", postId);
        jsonObject.put("username", username);
        jsonObject.put("nickname", nickname);
        jsonObject.put("phone", phone);
        jsonObject.put("sign", sign);

        try {
            BaseQueryUserService baseQueryUserService = (BaseQueryUserService) Class.forName("com.wing.api.query.user.impl." + QueryUserServiceType.typeMap.get(type)).newInstance();
            return baseQueryUserService.queryList(jsonObject, enterpricceIdVo, userClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询用户详情
     * @return
     */
    @ApiOperation(value = "查询用户详情", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", example = "id", dataType = "Long", paramType = "query")
    })
    @GetMapping("/queryUserDetail")
    public JsonResult queryUserDetail(Long id, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }

        try {
            BaseQueryUserService baseQueryUserService = (BaseQueryUserService) Class.forName("com.wing.api.query.user.impl." + QueryUserServiceType.typeMap.get(type)).newInstance();
            return baseQueryUserService.queryDetail(id, enterpricceIdVo, sign);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询角色列表
     * @return
     */
    @ApiOperation(value = "查询所有角色", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", example = "1", required = true,  dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "limit", value = "每页多少条", example = "10", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "departmentId", value = "部门ID", example = "departmentId", dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "roleName", value = "角色名", example = "roleName", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryRoleList")
    public PageResult<Role> queryRoleList(Integer page, Integer limit,
                                          Long departmentId, String roleName, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("departmentId", departmentId);
        jsonObject.put("roleName", roleName);
        jsonObject.put("sign", sign);

        try {
            BaseQueryRoleService baseQueryRoleService = (BaseQueryRoleService) Class.forName("com.wing.api.query.role.impl." + QueryRoleServiceType.typeMap.get(type)).newInstance();
            return baseQueryRoleService.queryList(jsonObject, enterpricceIdVo, userClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询角色详情
     * @return
     */
    @ApiOperation(value = "查询角色详情", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", example = "id", dataType = "Long", paramType = "query")
    })
    @GetMapping("/queryRoleDetail")
    public JsonResult queryRoleDetail(Long id, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }

        try {
            BaseQueryRoleService baseQueryRoleService = (BaseQueryRoleService) Class.forName("com.wing.api.query.role.impl." + QueryRoleServiceType.typeMap.get(type)).newInstance();
            return baseQueryRoleService.queryDetail(id, enterpricceIdVo, sign);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询部门列表
     * @return
     */
    @ApiOperation(value = "查询所有部门", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", example = "1", required = true,  dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "limit", value = "每页多少条", example = "10", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "名称", example = "name", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryDepartmentList")
    public PageResult<Department> queryDepartmentList(Integer page, Integer limit,
                                                      String name, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("name", name);
        jsonObject.put("sign", sign);

        try {
            BaseQueryDepartmentService baseQueryDepartmentService = (BaseQueryDepartmentService) Class.forName("com.wing.api.query.department.impl." + QueryDepartmentServiceType.typeMap.get(type)).newInstance();
            return baseQueryDepartmentService.queryList(jsonObject, enterpricceIdVo, userClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询部门详情
     * @return
     */
    @ApiOperation(value = "查询部门详情", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", example = "id", dataType = "Long", paramType = "query")
    })
    @GetMapping("/queryDepartmentDetail")
    public JsonResult queryDepartmentDetail(Long id, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }

        try {
            BaseQueryDepartmentService baseQueryDepartmentService = (BaseQueryDepartmentService) Class.forName("com.wing.api.query.department.impl." + QueryDepartmentServiceType.typeMap.get(type)).newInstance();
            return baseQueryDepartmentService.queryDetail(id, enterpricceIdVo, sign);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询公司列表
     * @return
     */
    @ApiOperation(value = "查询所有公司", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", example = "1", required = true,  dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "limit", value = "每页多少条", example = "10", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "名称", example = "name", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryCompanyInfoList")
    public PageResult<CompanyInfo> queryCompanyInfoList(Integer page, Integer limit,
                                                        String name, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("name", name);
        jsonObject.put("sign", sign);

        try {
            BaseQueryCompanyService baseQueryCompanyService = (BaseQueryCompanyService) Class.forName("com.wing.api.query.company.impl." + QueryCompanyServiceType.typeMap.get(type)).newInstance();
            return baseQueryCompanyService.queryList(jsonObject, enterpricceIdVo, userClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询公司详情
     * @return
     */
    @ApiOperation(value = "查询公司详情", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", example = "id", dataType = "Long", paramType = "query")
    })
    @GetMapping("/queryCompanyInfoDetail")
    public JsonResult queryCompanyInfoDetail(Long id, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }

        try {
            BaseQueryCompanyService baseQueryCompanyService = (BaseQueryCompanyService) Class.forName("com.wing.api.query.company.impl." + QueryCompanyServiceType.typeMap.get(type)).newInstance();
            return baseQueryCompanyService.queryDetail(id, enterpricceIdVo, sign);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询系列列表
     * @return
     */
    @ApiOperation(value = "查询所有系列", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", example = "1", required = true,  dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "limit", value = "每页多少条", example = "10", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "名称", example = "name", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "productCode", value = "系列编号", example = "productCode", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "specCode", value = "规格编号", example = "specCode", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryProductSeriesList")
    public PageResult<Product> queryProductSeriesList(Integer page, Integer limit,
                                                      String name,String productCode,String specCode, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("name", name);
        jsonObject.put("productCode", productCode);
        jsonObject.put("specCode", specCode);
        jsonObject.put("sign", sign);

        try {
            BaseQueryProductSeriesService baseQueryProductSeriesService = (BaseQueryProductSeriesService) Class.forName("com.wing.api.query.productSeries.impl." + QueryProductSeriesServiceType.typeMap.get(type)).newInstance();
            return baseQueryProductSeriesService.queryList(jsonObject, enterpricceIdVo, enterpriseClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询系列详情
     * @return
     */
    @ApiOperation(value = "查询系列详情", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", example = "id", dataType = "Long", paramType = "query")
    })
    @GetMapping("/queryProductSeriesDetail")
    public JsonResult queryProductSeriesDetail(Long id, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }

        try {
            BaseQueryProductSeriesService baseQueryProductSeriesService = (BaseQueryProductSeriesService) Class.forName("com.wing.api.query.productSeries.impl." + QueryProductSeriesServiceType.typeMap.get(type)).newInstance();
            return baseQueryProductSeriesService.queryDetail(id, enterpricceIdVo, sign);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }


    /**
     *  查询物料列表
     * @return
     */
    @ApiOperation(value = "查询所有物料", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", example = "1", required = true,  dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "limit", value = "每页多少条", example = "10", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "skuName", value = "名称", example = "skuName", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "skuCode", value = "物料编码", example = "skuCode", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "productId", value = "系列ID", example = "productId", dataType = "Long", paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "起始时间", example = "startTime", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间", example = "endTime", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryProductInfoList")
    public PageResult<ProductDetail> queryProductInfoList(Integer page, Integer limit, String skuName, String skuCode,
              Long productId, String startTime, String endTime, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("skuName", skuName);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("productId", productId);
        jsonObject.put("startTime", startTime);
        jsonObject.put("endTime", endTime);
        jsonObject.put("sign", sign);

        try {
            BaseQueryProductDetailService baseQueryProductDetailService = (BaseQueryProductDetailService) Class.forName("com.wing.api.query.productDetail.impl." + QueryProductDetailServiceType.typeMap.get(type)).newInstance();
            return baseQueryProductDetailService.queryList(jsonObject, enterpricceIdVo, enterpriseClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     *  查询物料详情
     * @return
     */
    @ApiOperation(value = "查询物料详情", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", example = "id", dataType = "Long", paramType = "query")
    })
    @GetMapping("/queryProductInfoDetail")
    public JsonResult queryProductInfoDetail(Long id, String sign) {

        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }

        try {
            BaseQueryProductDetailService baseQueryProductDetailService = (BaseQueryProductDetailService) Class.forName("com.wing.api.query.productDetail.impl." + QueryProductDetailServiceType.typeMap.get(type)).newInstance();
            return baseQueryProductDetailService.queryDetail(id, enterpricceIdVo, sign);
        }catch (Exception e){
            log.error("系统错误:", e);
            return null;
        }

    }

    /**
     * 查询柜子
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", required = true, dataType = "String", paramType = "query")
    })
    @GetMapping("/getCabinetAll")
    public JsonResult<List<Cabinet>> getProductTypeVOAll(String sign){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);

        try {
            BaseQueryCabinetService baseQueryCabinetService = (BaseQueryCabinetService) Class.forName("com.wing.api.query.cabinet.impl." + QueryCabinetServiceType.typeMap.get(type)).newInstance();
            return baseQueryCabinetService.queryList(jsonObject, enterpricceIdVo);
        }catch (Exception e){
            log.error("系统错误:", e);
            return JsonResult.fail("查询柜子失败:" + e.getMessage());
        }
    }

    /**
     * 查询物料
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "sku编号", required = false, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "cabinetId", value = "刀柜ID", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "AE984F4E1234B43477A344C", required = true, dataType = "String", paramType = "query")
    })
    @GetMapping("/getProductDetailPageList")
    public PageResult<ProductDetailVO> getProductDetailPageList(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,String skuCode
            ,Long cabinetId
            ,String sign
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("cabinetId", cabinetId);
        jsonObject.put("sign", sign);

        try {
            BaseQueryProductDetailService baseQueryProductDetailService = (BaseQueryProductDetailService) Class.forName("com.wing.api.query.productDetail.impl." + QueryProductDetailServiceType.typeMap.get(type)).newInstance();
            return baseQueryProductDetailService.getProductDetailPageList(jsonObject, enterpricceIdVo, enterpriseClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询物料失败:" + e.getMessage(), new ArrayList<>());
        }
    }


    /**
     * 查询工序
     * @return
     */
    @GetMapping("/queryProcessInfoList")
    public PageResult<ProcessInfoVO> getProcessInfoPageList(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,String sign
            ,String name
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("name", name);
        jsonObject.put("sign", sign);

        try {
            BaseQueryProcessInfoService baseQueryProcessInfoService = (BaseQueryProcessInfoService) Class.forName("com.wing.api.query.processInfo.impl." + QueryProcessInfoServiceType.typeMap.get(type)).newInstance();
            return baseQueryProcessInfoService.queryList(jsonObject, enterpricceIdVo, enterpriseClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询工序失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询设备
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "name", value = "设备名称", defaultValue = "", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "deviceCode", value = "设备编码", defaultValue = "", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryDeviceList")
    public PageResult<Device> queryDeviceList(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,String sign
            ,String name
            ,String deviceCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("name", name);
        jsonObject.put("deviceCode", deviceCode);
        jsonObject.put("sign", sign);

        try {
            BaseQueryDeviceService baseQueryDeviceService = (BaseQueryDeviceService) Class.forName("com.wing.api.query.device.impl." + QueryDeviceServiceType.typeMap.get(type)).newInstance();
            return baseQueryDeviceService.queryList(jsonObject, enterpricceIdVo, enterpriseClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询设备失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询工单
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "code", value = "设备名称", defaultValue = "", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "设备编码", defaultValue = "", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "startTime", value = "设备编码", defaultValue = "", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "endTime", value = "设备编码", defaultValue = "", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/querySimpleWorkOrderList")
    public PageResult<SimpleWorkOrder> querySimpleWorkOrderList(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,String sign
            ,String code
            ,String skuCode
            ,String startTime
            ,String endTime
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("code", code);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("startTime", startTime);
        jsonObject.put("endTime", endTime);
        jsonObject.put("sign", sign);

        try {
            BaseQuerySimpleWorkOrderService baseQuerySimpleWorkOrderService = (BaseQuerySimpleWorkOrderService) Class.forName("com.wing.api.query.simpleWorkOrder.impl." + QuerySimpleWorkOrderServiceType.typeMap.get(type)).newInstance();
            return baseQuerySimpleWorkOrderService.queryList(jsonObject, enterpricceIdVo, productionClient);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询工单失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询仓库
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "name", value = "名称", defaultValue = "", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "code", value = "编码", defaultValue = "", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getWarehouseList")
    public PageResult<WarehouseVO> getWarehouseList(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,String sign
            ,String name
            ,String code
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("name", name);
        jsonObject.put("code", code);
        try {
            BaseQueryWarehouseService baseQueryWarehouseService = (BaseQueryWarehouseService) Class.forName("com.wing.api.query.warehouse.impl." + QueryWarehouseServiceType.typeMap.get(type)).newInstance();
            return baseQueryWarehouseService.queryList(jsonObject, enterpricceIdVo, warehouseService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询仓库失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询出入库类型
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "inventoryType", value = "类型\n in:入库\n out:出库", example = "in", required = true, dataType = "String", paramType = "query")
    })
    @GetMapping("/getWarehouseInventoryTypeList")
    public PageResult<WarehouseInventoryType> getWarehouseInventoryTypeList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , WarehouseInventoryType.InventoryType inventoryType
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("inventoryType", inventoryType.getValue());
        try {
            BaseQueryWarehouseInventoryTypeService baseQueryWarehouseInventoryTypeService = (BaseQueryWarehouseInventoryTypeService) Class.forName("com.wing.api.query.warehouseInventoryType.impl." + QueryWarehouseInventoryTypeServiceType.typeMap.get(type)).newInstance();
            return baseQueryWarehouseInventoryTypeService.queryList(jsonObject, enterpricceIdVo, warehouseInventoryTypeService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询出入库类型失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询包装方案
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "productType", value = "物料类型ID", example = "in", required = true, dataType = "Integer", paramType = "query")
    })
    @GetMapping("/getProductPackList")
    public PageResult<ProductPackVO> getProductPackList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , Long productType
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("productType", productType);
        try {
            BaseQueryProductPackService baseQueryProductPackService = (BaseQueryProductPackService) Class.forName("com.wing.api.query.productPack.impl." + QueryProductPackServiceType.typeMap.get(type)).newInstance();
            return baseQueryProductPackService.queryList(jsonObject, enterpricceIdVo, productPackService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询出入库类型失败:" + e.getMessage(), new ArrayList<>());
        }
    }


    /**
     * 查询领新柜库存列表(按产品)
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "oldSpecCode", value = "规格码", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getCellInventoryProductList")
    public PageResult<CellInventoryProductVO> getCellInventoryProductList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , String skuCode
            , String oldSpecCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("oldSpecCode", oldSpecCode);
        try {
            BaseQueryCellInventoryProductService baseQueryCellInventoryProductService = (BaseQueryCellInventoryProductService) Class.forName("com.wing.api.query.cellInventoryProduct.impl." + QueryCellInventoryProductServiceType.typeMap.get(type)).newInstance();
            return baseQueryCellInventoryProductService.queryList(jsonObject, enterpricceIdVo, cellInventoryProductService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询领新柜库存列表(按产品)失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询领新柜库存列表(按货道)
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "cabCode", value = "副柜编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "belongCabinet", value = "主柜编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "spaceCode", value = "货道编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "oldSpecCode", value = "规格码", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getCellInventorySpaceList")
    public PageResult<CellInventorySpaceVO> getCellInventorySpaceList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , String cabCode
            , String belongCabinet
            , String spaceCode
            , String skuCode
            , String oldSpecCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("cabCode", cabCode);
        jsonObject.put("belongCabinet", belongCabinet);
        jsonObject.put("spaceCode", spaceCode);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("oldSpecCode", oldSpecCode);
        try {
            BaseQueryCellInventorySpaceService baseQueryCellInventorySpaceService = (BaseQueryCellInventorySpaceService) Class.forName("com.wing.api.query.cellInventorySpace.impl." + QueryCellInventorySpaceServiceType.typeMap.get(type)).newInstance();
            return baseQueryCellInventorySpaceService.queryList(jsonObject, enterpricceIdVo, cellInventorySpaceService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询领新柜库存列表(按货道)失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询领新柜库存列表(按主柜)
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "cabCode", value = "副柜编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "oldSpecCode", value = "规格码", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getCellInventoryCabinetList")
    public PageResult<CellSingleInventoryProductVO> getCellInventoryCabinetList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , String cabCode
            , String skuCode
            , String oldSpecCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("cabCode", cabCode);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("oldSpecCode", oldSpecCode);
        try {
            BaseQueryCellInventoryCabinetService baseQueryCellInventoryCabinetService = (BaseQueryCellInventoryCabinetService) Class.forName("com.wing.api.query.cellInventoryCabinet.impl." + QueryCellInventoryCabinetServiceType.typeMap.get(type)).newInstance();
            return baseQueryCellInventoryCabinetService.queryList(jsonObject, enterpricceIdVo, cellSingleInventoryProductService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询领新柜库存列表(按主柜)失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询暂存柜库存列表(按产品)
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "oldSpecCode", value = "规格码", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getStorageInventoryProductList")
    public PageResult<StorageInventoryProductVO> getStorageInventoryProductList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , String skuCode
            , String oldSpecCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("oldSpecCode", oldSpecCode);
        try {
            BaseQueryStorageInventoryProductService baseQueryStorageInventoryProductService = (BaseQueryStorageInventoryProductService) Class.forName("com.wing.api.query.storageInventoryProduct.impl." + QueryStorageInventoryProductServiceType.typeMap.get(type)).newInstance();
            return baseQueryStorageInventoryProductService.queryList(jsonObject, enterpricceIdVo, storageInventoryProductService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询暂存柜库存列表(按产品)失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询暂存柜库存列表(按货道)
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "cabCode", value = "副柜编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "belongCabinet", value = "主柜编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "businessType", value = "存储性质\n repair:报修\n temp:暂存\n recycle:报废", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "spaceCode", value = "货道编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "oldSpecCode", value = "规格码", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getStorageInventorySpaceList")
    public PageResult<StorageInventorySpaceVO> getStorageInventorySpaceList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , String cabCode
            , String belongCabinet
            , StorageInventorySpace.BusinessType businessType
            , String spaceCode
            , String skuCode
            , String oldSpecCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("cabCode", cabCode);
        jsonObject.put("belongCabinet", belongCabinet);
        jsonObject.put("businessType", null != businessType ? businessType.getValue() : null);
        jsonObject.put("spaceCode", spaceCode);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("oldSpecCode", oldSpecCode);
        try {
            BaseQueryStorageInventorySpaceService baseQueryStorageInventorySpaceService = (BaseQueryStorageInventorySpaceService) Class.forName("com.wing.api.query.storageInventorySpace.impl." + QueryStorageInventorySpaceServiceType.typeMap.get(type)).newInstance();
            return baseQueryStorageInventorySpaceService.queryList(jsonObject, enterpricceIdVo, storageInventorySpaceService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询暂存柜库存列表(按货道)失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询暂存柜库存列表(按主柜)
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "cabCode", value = "副柜编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "oldSpecCode", value = "规格码", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getStorageSingleInventoryCabinetList")
    public PageResult<StorageSingleInventoryProductVO> getStorageSingleInventoryCabinetList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , String cabCode
            , String skuCode
            , String oldSpecCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("cabCode", cabCode);
        jsonObject.put("skuCode", skuCode);
        jsonObject.put("oldSpecCode", oldSpecCode);
        try {
            BaseQueryStorageSingleInventoryCabinetService baseQueryStorageSingleInventoryCabinetService = (BaseQueryStorageSingleInventoryCabinetService) Class.forName("com.wing.api.query.storageSingleInventoryCabinet.impl." + QueryStorageSingleInventoryCabinetServiceType.typeMap.get(type)).newInstance();
            return baseQueryStorageSingleInventoryCabinetService.queryList(jsonObject, enterpricceIdVo, storageSingleInventoryProductService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询暂存柜库存列表(按主柜)失败:" + e.getMessage(), new ArrayList<>());
        }
    }

    /**
     * 查询上新列表
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", required = true, dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sign", value = "签名值", example = "", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "loadType", value = "操作类型\n load:上货\n unload:下货", example = "load", required = true, dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "startTime", value = "起始时间", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "endTime", value = "结束时间", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "cabCode", value = "柜子编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "spaceCode", value = "货道编号", example = "", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "skuCode", value = "物料编号", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/getOrderReceiveLoadDetailList")
    public PageResult<OrderReceiveLoadDetailVO> getOrderReceiveLoadDetailList(
            @RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer limit
            , String sign
            , OrderReceiveLoadForm.LoadType loadType
            , String startTime
            , String endTime
            , String cabCode
            , String spaceCode
            , String skuCode
    ){
        EnterpricceIdVO enterpricceIdVo = enterpricceIdService.getEnterpricceIdVO();
        String type = "";
        if("0".equals(enterpricceIdVo.getStandard())){
            type = "A99999";
        }else{
            type = enterpricceIdVo.getEnterpriseCode();
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("sign", sign);
        jsonObject.put("page", page);
        jsonObject.put("limit", limit);
        jsonObject.put("loadType", loadType.getValue());
        jsonObject.put("startTime", startTime);
        jsonObject.put("endTime", endTime);
        jsonObject.put("cabCode", cabCode);
        jsonObject.put("spaceCode", spaceCode);
        jsonObject.put("skuCode", skuCode);
        try {
            BaseQueryOrderReceiveLoadService baseQueryOrderReceiveLoadService = (BaseQueryOrderReceiveLoadService) Class.forName("com.wing.api.query.orderReceiveLoad.impl." + QueryOrderReceiveLoadServiceType.typeMap.get(type)).newInstance();
            return baseQueryOrderReceiveLoadService.queryList(jsonObject, enterpricceIdVo, orderReceiveLoadDetailService);
        }catch (Exception e){
            log.error("系统错误:", e);
            return new PageResult<>(Result.Code.FAIL, "查询上新列表失败:" + e.getMessage(), new ArrayList<>());
        }
    }

}


